package org.example.forum.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {
    @Bean
    public GroupedOpenApi forumApi() {
        return GroupedOpenApi.builder()
                .group("forum-api")
                .packagesToScan("org.example.forum.controller")
                .pathsToMatch("/**")
                .build();
    }
    @Bean
    public OpenAPI openAPI(){
        Contact contact = new Contact();
        contact.name("Bit Tech");
        contact.url("https://edu.bitejiuyeke.com");
        contact.email("1598896550@qq.com");

        return new OpenAPI()
                .info(new Info()
                        .title("论坛系统API")
                        .description("在线论坛系统接口文档")
                        .contact(contact)
                        .version("v1"));


    }
}
